package com.xlobo.api.inventory.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 库存预占用接口Call FreeMaker Template自动生成代码
 */
public class InventoryFreezeCall extends YmatouBaseCall {
	private static String opurl = "Inventory/Freeze";

	public InventoryFreezeCall() {
		super(EnvSetup.getSystemUrl("api_lnventory"), opurl, "POST", "JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getSuccess() {
		String Success = null;
		try {
			Success = new JSONObject(getReturnData()).getString("Success");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Success;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getString("Message");
			// BCode = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}
}